cmake_minimum_required(VERSION 3.0.2)
project(formation_avoidance)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
add_definitions(-std=c++11 -g -O3 -ftree-vectorize -march=native)
# add_definitions(-std=c++11 )

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  message_filters
  #mav_msgs
  geometry_msgs
  sensor_msgs
  gazebo_msgs
  tf
  nav_msgs
  image_transport
  cv_bridge
  message_generation
)

# add_message_files(
#   FILES
#   DistributedOptimize.msg
# ) 

generate_messages(
  DEPENDENCIES
  std_msgs
)



# set(Boost_LIBRARY_DIR /usr/lib/x86_64-linux-gnu/)
# set(PCL_DIR "/home/pp/Downloads/pcl/cmake")
find_package(PCL  REQUIRED)
find_package(OpenCV REQUIRED)
set(PCL_INCLUDE_DIRS /usr/include/pcl-1.8)
add_definitions(${PCL_DEFINITIONS})
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIRS})
include_directories("~/catkin_ws/devel/include/")
include_directories("/usr/include/pcl-1.8")


add_definitions(${PCL_DEFINITIONS})

catkin_package( CATKIN_DEPENDS message_runtime)

include_directories(${PCL_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_library(formation_library STATIC src/formation.cpp  src/utils.cpp)

target_include_directories(formation_library PUBLIC  ${PROJECT_SOURCE_DIR}/include )


# add_executable(agent0 src/agent0.cpp )
# target_link_libraries(agent0 formation_library ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )

# add_executable(agent1 src/agent1.cpp )
# target_link_libraries(agent1 formation_library ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )


# add_executable(agent2 src/agent2.cpp )
# target_link_libraries(agent2 formation_library ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )

# add_executable(agent3 src/agent3.cpp )
# target_link_libraries(agent3 formation_library ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )

# add_executable(convert_pointcloud src/convert_pointcloud.cpp )
# target_link_libraries(convert_pointcloud ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )

# add_executable(agent_exc src/agent_exc.cpp )
# target_link_libraries(agent_exc ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )



add_executable(avoidance src/avoidance.cpp )
target_link_libraries(avoidance formation_library  ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )




 add_executable(avoidance_change1 src/avoidance_change1.cpp )
 target_link_libraries(avoidance_change1 formation_library  ${OpenCV_LIBS} ${PCL_LIBRARIES} ${catkin_LIBRARIES} )